package cn.t212.cloud.ms.user;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class HelloController {
    @Value("${server.port}")
    private int port;

    @PostMapping("/users")
    public List<User> users(@RequestBody User user) {
        List<User> list = new ArrayList<>();
        list.add(user);
        list.add(new User(1,"系统","123456"));
        return list;
    }

    @GetMapping("/userHello")
    public String hello() {
        return "Hello User Service : " + port;
    }
}
